package com.jmlee.controller;

import com.jmlee.pojo.Carousel;
import com.jmlee.pojo.Category;
import com.jmlee.pojo.CommonResult;
import com.jmlee.service.CarouselService;
import com.jmlee.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description 首页接口
 * @Author jmLee
 * @Date 2021/3/7 18:38
 * @Version 1.0
 */
@RestController
public class IndexController {

    @Autowired
    private CarouselService carouselService;

    @Autowired
    private CategoryService categoryService;

    @GetMapping("/carousel")
    public CommonResult carousel() {

        List<Carousel> sixCarousel = carouselService.getSixCarousel();

        return CommonResult.success(sixCarousel, "ok");
    }


    @GetMapping("/rootCates")
    public CommonResult rootCategory() {

        List<Category> rootCates = categoryService.getAllRootCategory();

        return CommonResult.success(rootCates, "ok");
    }




}
